home *** CD-ROM | disk | FTP | other *** search
/ X User Tools / X User Tools (O'Reilly and Associates)(1994).ISO / sources / xpick / xpick_11.z / xpick_11 / xpick-1.1 / MultiListP.h < prev    next >
C/C++ Source or Header  |  1991-09-20  |  7KB  |  184 lines

  1. /****************************************************************************
  2.  
  3.     MultiListP.h
  4.  
  5.     This file is the private header file for the MultiList widget, an
  6.     extension to the Athena List widget.
  7.  
  8.     This code is loosely based on the Athena List source which
  9.     is why the MIT copyright notice appears below.
  10.  
  11.     July 1990, Brian Totty
  12.  
  13.  ****************************************************************************/
  14.  
  15. /*
  16.  * Copyright 1989 Massachusetts Institute of Technology
  17.  *
  18.  * Permission to use, copy, modify, distribute, and sell this software and its
  19.  * documentation for any purpose is hereby granted without fee, provided that
  20.  * the above copyright notice appear in all copies and that both that
  21.  * copyright notice and this permission notice appear in supporting
  22.  * documentation, and that the name of M.I.T. not be used in advertising or
  23.  * publicity pertaining to distribution of the software without specific,
  24.  * written prior permission.  M.I.T. makes no representations about the
  25.  * suitability of this software for any purpose.  It is provided "as is"
  26.  * without express or implied warranty.
  27.  *
  28.  * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
  29.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
  30.  * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  31.  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  32.  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 
  33.  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  34.  *
  35.  * Original Athena Author:  Chris D. Peterson, MIT X Consortium
  36.  */
  37.  
  38. #ifndef _MULTILISTP_H_
  39. #define _MULTILISTP_H_
  40.  
  41. #include <X11/Xaw/SimpleP.h>
  42. #include "MultiList.h"
  43.  
  44. /*---------------------------------------------------------------------------*
  45.  
  46.       L O C A L    D A T A    S T R U C T U R E    D E F I N I T I O N S
  47.  
  48.  *---------------------------------------------------------------------------*/
  49.  
  50. typedef    struct
  51. {
  52.     Boolean        sensitive;
  53.     Boolean        highlighted;
  54.     String        string;
  55. } MultiListItem;
  56.  
  57. /*---------------------------------------------------------------------------*
  58.  
  59.      W I D G E T    D A T A    S T R U C T U R E    D E F I N I T I O N S
  60.  
  61.  *---------------------------------------------------------------------------*/
  62.  
  63. typedef struct
  64. {
  65.     int        foo;
  66. } MultiListClassPart;
  67.  
  68. typedef struct _MultiListClassRec
  69. {
  70.     CoreClassPart    core_class;
  71.     SimpleClassPart    simple_class;
  72.     MultiListClassPart    multiList_class;
  73. } MultiListClassRec;
  74.  
  75. extern MultiListClassRec multiListClassRec;
  76.  
  77. typedef struct
  78. {
  79.     Pixel        foreground;
  80.     Pixel        highlight_fg;
  81.     Pixel        highlight_bg;
  82.     Dimension    column_space;
  83.     Dimension    row_space;
  84.     int        default_cols;
  85.     Boolean        force_cols;
  86.     Boolean        paste;
  87.     Boolean        row_major;
  88.     int        longest;
  89.     int        nitems;
  90.     XFontStruct    *font;
  91.     String        *list;
  92.     Boolean        *sensitive_array;
  93.     XtCallbackList  callback;
  94.     int        max_selectable;
  95.     Boolean        notify_highlights;
  96.     Boolean        notify_unhighlights;
  97.     Boolean        notify_opens;
  98.     Dimension    col_width;
  99.     Dimension    row_height;
  100.  
  101.     int        right_padding;
  102.     int        bottom_padding;
  103.     int        nrows;
  104.     int        ncols;
  105.     int        most_recent_clicked_item;
  106.     int        most_recent_action;
  107.     GC        erase_gc;
  108.     GC        draw_gc;
  109.     GC        highlight_bg_gc;
  110.     GC        highlight_fg_gc;
  111.     GC        gray_gc;
  112.     MultiListItem    *item_array;
  113.     int        num_selected;
  114.     int        *sel_array;
  115. } MultiListPart;
  116.  
  117. typedef struct _MultiListRec
  118. {
  119.     CorePart    core;
  120.     SimplePart    simple;
  121.     MultiListPart    multiList;
  122. } MultiListRec;
  123.  
  124. /*---------------------------------------------------------------------------*
  125.  
  126.           D A T A    S T R U C T U R E    A C C E S S    M A C R O S
  127.  
  128.  *---------------------------------------------------------------------------*/
  129.  
  130. #define    MultiListItemSensitive(i)    ((i)->sensitive)
  131. #define    MultiListItemHighlighted(i)    ((i)->highlighted)
  132. #define    MultiListItemString(i)        ((i)->string)
  133.  
  134. #define    InstanceCore(w)            (&((w)->core))
  135. #define    InstanceSimple(w)        (&((w)->simple))
  136. #define    InstanceMultiList(w)        (&((w)->multiList))
  137.  
  138. #define    MultiListWidth(w)        (InstanceCore(w)->width)
  139. #define    MultiListHeight(w)        (InstanceCore(w)->height)
  140. #define    MultiListBG(w)            (InstanceCore(w)->background_pixel)
  141. #define    MultiListSensitive(w)        (InstanceCore(w)->sensitive)
  142. #define    MultiListAncesSensitive(w)    (InstanceCore(w)->ancestor_sensitive)
  143. #define    MultiListDepth(w)        (InstanceCore(w)->depth)
  144.  
  145. #define    MultiListFG(w)            (InstanceMultiList(w)->foreground)
  146. #define    MultiListHighlightFG(w)        (InstanceMultiList(w)->highlight_fg)
  147. #define    MultiListHighlightBG(w)        (InstanceMultiList(w)->highlight_bg)
  148. #define    MultiListColumnSpace(w)        (InstanceMultiList(w)->column_space)
  149. #define    MultiListRowSpace(w)        (InstanceMultiList(w)->row_space)
  150. #define    MultiListDefaultCols(w)        (InstanceMultiList(w)->default_cols)
  151. #define    MultiListForceCols(w)        (InstanceMultiList(w)->default_cols)
  152. #define    MultiListPaste(w)        (InstanceMultiList(w)->paste)
  153. #define    MultiListRowMajor(w)        (InstanceMultiList(w)->row_major)
  154. #define    MultiListLongest(w)        (InstanceMultiList(w)->longest)
  155. #define    MultiListNumItems(w)        (InstanceMultiList(w)->nitems)
  156. #define    MultiListFont(w)        (InstanceMultiList(w)->font)
  157. #define    MultiListList(w)        (InstanceMultiList(w)->list)
  158. #define    MultiListSensitiveArray(w)    (InstanceMultiList(w)->sensitive_array)
  159. #define    MultiListCallback(w)        (InstanceMultiList(w)->callback)
  160. #define    MultiListMaxSelectable(w)    (InstanceMultiList(w)->max_selectable)
  161. #define    MultiListNotifySets(w)        (InstanceMultiList(w)->notify_highlights)
  162. #define    MultiListNotifyUnsets(w)    (InstanceMultiList(w)->notify_unhighlights)
  163. #define    MultiListNotifyOpens(w)        (InstanceMultiList(w)->notify_opens)
  164.  
  165. #define    MultiListColWidth(w)        (InstanceMultiList(w)->col_width)
  166. #define    MultiListRowHeight(w)        (InstanceMultiList(w)->row_height)
  167. #define    MultiListRightPadding(w)    (InstanceMultiList(w)->right_padding)
  168. #define    MultiListBottomPadding(w)    (InstanceMultiList(w)->bottom_padding)
  169. #define    MultiListNumRows(w)        (InstanceMultiList(w)->nrows)
  170. #define    MultiListNumCols(w)        (InstanceMultiList(w)->ncols)
  171. #define    MultiListMostRecentItem(w)    (InstanceMultiList(w)->most_recent_clicked_item)
  172. #define    MultiListMostRecentAct(w)    (InstanceMultiList(w)->most_recent_action)
  173. #define    MultiListEraseGC(w)        (InstanceMultiList(w)->erase_gc)
  174. #define    MultiListDrawGC(w)        (InstanceMultiList(w)->draw_gc)
  175. #define    MultiListHighlightForeGC(w)    (InstanceMultiList(w)->highlight_fg_gc)
  176. #define    MultiListHighlightBackGC(w)    (InstanceMultiList(w)->highlight_bg_gc)
  177. #define    MultiListGrayGC(w)        (InstanceMultiList(w)->gray_gc)
  178. #define    MultiListItemArray(w)        (InstanceMultiList(w)->item_array)
  179. #define    MultiListNthItem(w,n)        (&(MultiListItemArray(w)[n]))
  180. #define    MultiListSelArray(w)        (InstanceMultiList(w)->sel_array)
  181. #define    MultiListNumSelected(w)        (InstanceMultiList(w)->num_selected)
  182.  
  183. #endif
  184.